package com.ruoyi.work.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.work.mapper.WorkExpenseMapper;
import com.ruoyi.work.domain.WorkExpense;
import com.ruoyi.work.service.IWorkExpenseService;
import com.ruoyi.common.core.text.Convert;

/**
 * 报销登记Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-02-03
 */
@Service
public class WorkExpenseServiceImpl implements IWorkExpenseService 
{
    @Autowired
    private WorkExpenseMapper workExpenseMapper;

    /**
     * 查询报销登记
     * 
     * @param expenseId 报销登记主键
     * @return 报销登记
     */
    @Override
    public WorkExpense selectWorkExpenseByExpenseId(Long expenseId)
    {
        return workExpenseMapper.selectWorkExpenseByExpenseId(expenseId);
    }

    /**
     * 查询报销登记列表
     * 
     * @param workExpense 报销登记
     * @return 报销登记
     */
    @Override
    public List<WorkExpense> selectWorkExpenseList(WorkExpense workExpense)
    {
        return workExpenseMapper.selectWorkExpenseList(workExpense);
    }

    /**
     * 新增报销登记
     * 
     * @param workExpense 报销登记
     * @return 结果
     */
    @Override
    public int insertWorkExpense(WorkExpense workExpense)
    {
        workExpense.setCreateTime(DateUtils.getNowDate());
        return workExpenseMapper.insertWorkExpense(workExpense);
    }

    /**
     * 修改报销登记
     * 
     * @param workExpense 报销登记
     * @return 结果
     */
    @Override
    public int updateWorkExpense(WorkExpense workExpense)
    {
        workExpense.setUpdateTime(DateUtils.getNowDate());
        return workExpenseMapper.updateWorkExpense(workExpense);
    }

    /**
     * 批量删除报销登记
     * 
     * @param expenseIds 需要删除的报销登记主键
     * @return 结果
     */
    @Override
    public int deleteWorkExpenseByExpenseIds(String expenseIds)
    {
        return workExpenseMapper.deleteWorkExpenseByExpenseIds(Convert.toStrArray(expenseIds));
    }

    /**
     * 删除报销登记信息
     * 
     * @param expenseId 报销登记主键
     * @return 结果
     */
    @Override
    public int deleteWorkExpenseByExpenseId(Long expenseId)
    {
        return workExpenseMapper.deleteWorkExpenseByExpenseId(expenseId);
    }
    @Override
    public List<WorkExpense> selectWorkExpenseByExpenseIds(String[] expenseIds){
        return workExpenseMapper.selectWorkExpenseByExpenseIds(expenseIds);
    }
    /**
     * 销账查询返款单
     *
     * @param incomingId 来款主键
     * @return 结果
     */
    public List<WorkExpense>  selectBackByCancel(Long incomingId) {
        return workExpenseMapper.selectBackByCancel(incomingId);
    }
    /**
     * 销账查询税金单
     *
     * @param incomingId 来款主键
     * @return 结果
     */
    public List<WorkExpense>  selectTaxByCancel(Long incomingId) {

        return workExpenseMapper.selectTaxByCancel(incomingId);
    }
}
